import GithubOAuthStore from './GithubOAuthStore';
import LocationStore from './LocationStore';
import PageLoaderStore from './PageLoaderStore';

export interface IGlobalStore {
    destroy(): void;
}

class RootStoreClass implements IGlobalStore {
    readonly locationStore = new LocationStore();
    readonly pageLoader = new PageLoaderStore();
    readonly githubOAuth = new GithubOAuthStore();

    destroy(): void {
        this.locationStore.destroy();
        this.githubOAuth.destroy();
    }
}

const RootStore = new RootStoreClass();

export const RootDestroyer = (): void => RootStore.destroy();

export default RootStore;
